/*******************************************************************************
*  Project      : Minigate Golfin                                 
*  Program ID   : booking_common.js                                 
*  Description  : 예약 공통 모듈
*
********************************************************************************
*  Program History                                                            
*  Date        Author    Description                                          
*  ----------  --------  -------------------------------------------------------- 
*  2012-07-26  김효순    Created.  
*******************************************************************************/

// 좌측 예약분류
function clsLeftReserveType()
{
	this._HTMLDom = null;
	this._listData = null;
	
	this._init();
}

clsLeftReserveType.prototype = {
	_init: function(){
		var $layer = $("div#container section#left_content article.ma_bottom25");
		this._HTMLDom = {
			"$layer": $layer
		}
		
		this._setList([
			"실시간 예약"
			//, "웨이팅 예약"
			, "자선예약"
		]);
	}
	, $getLayer: function(){
		return this._HTMLDom["$layer"];
	}
	, _setList: function(thisData){
		this._listData = thisData;
		this._display();
	}
	, _display: function(){
		var $layer = this.$getLayer();
		var thisClass = this;
		
		$layer.find("select").empty();
		for(var i=0;i<this._listData.length;i++){
			$layer.find("select").append("<option>" + thisClass._listData[i] + "</option>");
		}
	}
	, setIdx: function(idx){
		var $layer = this.$getLayer();
		$layer.find("option").eq(idx).prop("selected", true);
	}
	, getIdx: function(){
		var $layer = this.$getLayer();
		
		return $layer.find("option").index($layer.find("option:selected"));
	}
}

// 달력
function clsCalendar()
{
	this._HTMLDom = null;
	this.infoData = null;
	
	this._init();
}

clsCalendar.prototype = {
	_init: function(){
		var $layer = $("div#container section#left_content article.calendar");
		$layer.find("tbody tr").find("td:first-child").css({
			"color": "#be3c3a"
			, "font-weight": "bold"
		}).end().find("td:last-child").css({
			"color": "#1885a6"
			, "font-weight": "bold"
		});
		this._HTMLDom = {
			"$layer": $layer
			, "$element": $layer.find("tr:first").clone(true)
		}
		
		this.infoData = {
			"달력일": null
			, "시작일": null
		}
	}
	, $getLayer: function(){
		return this._HTMLDom["$layer"];
	}
	, setInfo: function(key, val){
		switch(key){
			case "달력일":
				val.setDate(1);
				break;
			case "시작일":
				if(this.infoData["달력일"] && val.getMonth() != this.infoData["달력일"].getMonth()){
					var nDate = new Date();
					nDate.setTime(val.getTime());
					nDate.setDate(1);
					
					this.infoData["달력일"] = nDate;
				}
				break;
		}
		
		this.infoData[key] = val;
		this.display();
	}
	, nextMonth: function(){
		this.infoData["달력일"].setMonth(this.infoData["달력일"].getMonth()+1);
		this.display();
	}
	, prevMonth: function(){
		this.infoData["달력일"].setMonth(this.infoData["달력일"].getMonth()-1);
		this.display();
	}
	, getSDate: function(){
		return this.infoData["시작일"];
	}
	, display: function(){
		if(!(this.infoData["달력일"] &&  this.infoData["시작일"])) return;
		
		var $layer = this.$getLayer();
		var $element = this._HTMLDom["$element"];
		var thisClass = this;
		var dayOfWeek = this.infoData["달력일"].getDay();
		var endDay = new Date(this.infoData["달력일"].getFullYear(), this.infoData["달력일"].getMonth()+1, 0).getDate();
		
		$layer.find("dt:first").contents().eq(0).remove().end().end().prepend((this.infoData["달력일"].getMonth()+1) + "월");
		
		$layer.find("tbody").empty();
		for(var i=1;i-dayOfWeek<=endDay;i+=7){
			$layer.find("tbody").append($element.clone(true));
		}
		
		var today = new Date();
		today.setHours(0);
		today.setMinutes(0);
		today.setSeconds(0);
		today.setMilliseconds(0);
		
		$layer.find("tbody tr td").each(function(n){
			var thisDay = n-dayOfWeek+1;
			
			$(this).attr("class", "").html("");
			if(thisDay > 0 && thisDay <= endDay){
				var newDate = new Date();
				newDate.setTime(thisClass.infoData["달력일"].getTime());
				newDate.setDate(thisDay);
				
				var endDate = new Date();
				endDate.setTime(thisClass.infoData["시작일"].getTime());
				endDate.setDate(endDate.getDate() + document.objControl.getCalendarPeriod()-1);
				
				$(this).html(thisDay).data("날짜", newDate);
				if(newDate.getTime() < today.getTime()) $(this).addClass("no_active");
				if(newDate.getTime() == today.getTime()) $(this).addClass("today");
				if(newDate.getTime() == thisClass.infoData["시작일"].getTime()) $(this).addClass("start_day");
				if(newDate.getTime() > thisClass.infoData["시작일"].getTime() && newDate.getTime() <= endDate.getTime()) $(this).addClass("res_day");
			}else{
				$(this).data("날짜", null);
			}
		});
	}
	, $getBtnPrev: function(){
		return this.$getLayer().find("span.bt_prev");
	}
	, $getBtnNext: function(){
		return this.$getLayer().find("span.bt_next");
	}
	, $getBtnCalendar: function(){
		return this.$getLayer().find("tbody tr td");
	}
}

// 지역선택(좌메뉴)
function clsAreaGolfList()
{
	this._HTMLDom = null;
	this.listData = null;
	
	this._init();
}

clsAreaGolfList.prototype = {
	_init: function(){
		var $layer = $("div#container section#left_content article.area_choice dl");
		this._HTMLDom = {
			"$layer": $layer
			, "$element": $layer.find("label:first").clone(true)
		}
	}
	, $getLayer: function(){
		return this._HTMLDom["$layer"];
	}
	, setAreaList: function(thisData){
		this.listData = [{
			"코스코드": ""
			, "내용": "전체"
		}].concat(thisData);
	}
	, setGolfList: function(thisData){
		for(var i=0;i<thisData.length;i++){
			for(var j=0;j<this.listData.length;j++){
				if(this.listData[j]["지역코드"] == thisData[i]["지역코드"]) break;
			}
			if(j < this.listData.length){
				if(!this.listData[j]["골프리스트"]) this.listData[j]["골프리스트"] = new Array();
				this.listData[j]["골프리스트"].push(thisData[i]);
			}
		}
		
		this.display();
	}
	, setMyConfig: function(thisData){
		var $layer = this.$getLayer();
		
		$layer.find("input:checkbox").prop("checked", false);
		for(var i=0;i<thisData.length;i++){
			var $obj = $layer.find("input:checkbox[value='" + thisData[i]["지역코드"] + "," + thisData[i]["골프장코드"] + "']");
			$obj.prop("checked", true);
		}
		
		this.checkcheck();
	}
	, display: function(){
		var $layer = this.$getLayer();
		var $element = this._HTMLDom["$element"];
		var thisClass = this;
		
		$layer.empty();
		for(var i=0;i<this.listData.length;i++){
			var item = this.listData[i];
			var items = item["골프리스트"]
			
			$layer.append("<dt />").find("dt:last").append($element.clone(true));
			
			if(items){
				$layer.append("<dd />");
				for(var j=0;j<items.length;j++){
					$layer.find("dd:last").append($element.clone(true));
				}
				$layer.find("dd:last label").each(function(n){
					$(this).find(":checkbox").val(items[n]["지역코드"] + "," + items[n]["골프장코드"]);
					$(this).contents().eq(1).remove().end().end().append(items[n]["골프장명"]);
				});
			}
		}
		$layer.find("dt label").each(function(n){
			$(this).contents().eq(1).remove().end().end().append(thisClass.listData[n]["내용"]);
		});
	}
	, getValue: function(){
		var $layer = this.$getLayer();
		var szRet = "";
		
		$layer.find(":checkbox:checked").filter(function(){
			if($(this).parent().parent().get(0).tagName.toUpperCase() == "DD") return true;
			else return false;
		}).each(function(){
			if(szRet) szRet += ",";
			szRet += $(this).val();
		});
		
		return szRet;
	}
	, setValue: function(thisData){
		var $layer = this.$getLayer();
		
		if(!thisData.length) return;
		
		$layer.find("input:checkbox").prop("checked", false);
		for(var i=0;i<thisData.length;i++){
			$layer.find("input:checkbox[value='" + thisData[i]["지역코드"] + "," + thisData[i]["골프장코드"] + "']").prop("checked", true);
		}
	}
	, spinStart: function(){
		var $layer = this.$getLayer();
		
		$layer.hide();
		if($layer.parent().find("div#tmpSpin").length == 0){
			$layer.parent().prepend("<div id='tmpSpin' style='position:absolute; width:160px; height:150px;' />");
		}
		$layer.parent().find("div#tmpSpin").show().spin();
	}
	, spinEnd: function(){
		var $layer = this.$getLayer();
		
		$layer.parent().find("div#tmpSpin").hide().spin(false);
		$layer.show();
	}
	, $getCheckBoxs: function(){
		return this.$getLayer().find("input:checkbox");
	}
	, checkcheck: function(){
		var $layer = this.$getLayer();
		
		$layer.find("dd").each(function(){
			var a = $(this).find("input:checkbox").length;
			var b = $(this).find("input:checkbox:checked").length;
			
			var $p = $(this).prev("dt").find("input:checkbox");
			$p.prop("checked", Boolean(a && a == b));
		});
		
		var a = $layer.find("dt:gt(0) input:checkbox").length;
		var b = $layer.find("dt:gt(0) input:checkbox:checked").length;
		$layer.find("dt:eq(0) input:checkbox").prop("checked", Boolean(a && a==b));
	}
}

// 나의 예약내역 확인
function clsMyReserveListConfirm()
{
	this._HTMLDom = null;
	this.listData = null;
	
	this._init();
}

clsMyReserveListConfirm.prototype = {
	_init: function(){
		$layer = $("div#container section#left_content div.reserv_bt");
		this._HTMLDom = {
			"$layer": $layer
		}
		
		this.setList([]);
		
		if(!_util.getCookie("member_id")) $layer.hide();
	}
	, $getLayer: function(){
		return this._HTMLDom["$layer"];
	}
	, setList: function(thisData){
		this.listData = thisData;
		this.display();
	}
	, display: function(){
		var $layer = this._HTMLDom["$layer"];
		
		$layer.find("span").html("(" + this.listData.length + ")");
	}
}


function clsBookingComm()
{
	
	
	this._init();
}

clsBookingComm.prototype = {
	_init: function(){
		
	}
	// 골프장 리스트
	, getGolfList: function(arg){
		var thisClass = this;
		
		arg = arg || {};
		arg["콜백"] = arg["콜백"] || function(){};
		
		//ajax
		var serviceName = "reservSearchGolfclub";
		document.objGlobal.ajax({
			"sid": "RS001"
			, "servicename": serviceName
		}, {
			"region": ""
			, "golfclub_id": ""
		}, function(ret){
			var res = {
				"결과코드": ret["msp"]["contents"]["serviceResult"]
				, "메시지": document.objGlobal.getResultMsg(ret)
				, "결과값": []
			}
			
			var items = ret["msp"]["contents"]["items"];
			if(items){
				if(!items.length) items = new Array(items);
				
				for(var i=0;i<items.length;i++){
					var obj = items[i];
					
					res["결과값"].push({
						"지역코드": obj["region"]
						, "골프장코드": obj["golfclub__id"]
						, "골프장명": obj["golfclub__name"]
					});
				}
			}
			
			arg["콜백"].apply(null, [res]);
		});
	}
	// 나의 설정
	, getMyConfig: function(arg){
		var thisClass = this;
		
		arg = arg || {};
		arg["콜백"] = arg["콜백"] || function(){};
		
		//ajax
		var serviceName = "reservMyOption";
		document.objGlobal.ajax({
			"sid": "RS001"
			, "servicename": serviceName
		}, {
			
		}, function(ret){
			var res = {
				"결과코드": ret["msp"]["contents"]["serviceResult"]
				, "메시지": document.objGlobal.getResultMsg(ret)
				, "결과값": []
			}
			
			var items = ret["msp"]["contents"]["items"];
			
			if(items){
				if(!items.length) items = new Array(items);
				
				for(var i=0;i<items.length;i++){
					var obj = items[i];
					
					res["결과값"].push({
						"지역코드": _util.nvl(obj["region"])
						, "골프장코드": _util.nvl(obj["golfclub__id"])
					});
				}
			}
			arg["콜백"].apply(null, [res]);
		});
	}
	// 최근 예약 목록
	, getRecentReserveList: function(arg){
		var thisClass = this;
		
		arg = arg || {}
		arg["콜백"] = arg["콜백"] || function(){}
		
		//ajax
		var serviceName = "getMyReservList";
		var options = {
			
		}
		_gf.ajax({
			"sid": "RS001"
			, "servicename": serviceName
			, "listcount": 100000
			, "currpageno": 1
		}, options, function(ret){
			var res = {
				"결과코드": ret["msp"]["contents"]["serviceResult"]
				, "메시지": _gf.getResultMsg(ret)
				, "결과값": []
			}
			
			var items = ret["msp"]["contents"]["items"];
			if(items){
				if(!items.length) items = new Array(items);
				for(var i=0;i<items.length;i++){
					var obj = items[i];
					var reserve_date = _util.nvl(obj["reserv__date"])+"";
					var reserve_time = _util.nvl(obj["reserv__time"])+"";
					
					var szEvent = "";
				
					if(obj["greenfee__use__yn"] == "Y"){
						szEvent = "그린피";
					}
					
					if(obj["cartfee__use__yn"] == "Y"){
						if(szEvent) szEvent += ",";
						szEvent += "카트피";
					}
					
					if(obj["food__use__yn"] == "Y"){
						if(szEvent) szEvent += ",";
						szEvent += "식사";
					}
					
					if(obj["present__use__yn"] == "Y"){
						if(szEvent) szEvent += ",";
						szEvent += "선물";
					}
					
					if(obj["present__use__yn"] == "Y"){
						if(szEvent) szEvent += ",";
						szEvent += "선물";
					}
					
					if(obj["etc__use__yn"] == "Y"){
						if(szEvent) szEvent += ",";
						szEvent += "기타";
					}
					
					res["결과값"].push({
						"키": _util.nvl(obj["reserv__seq"])
						, "날짜": reserve_date.substrEx(0, 4) + "." + reserve_date.substrEx(4, 2) + "." + reserve_date.substrEx(6, 2)
						, "시간": reserve_date.substrEx(0, 2) + ":" + reserve_date.substrEx(2, 2)
						, "골프장명": _util.nvl(obj["golfclub__name"])
						, "코스명": _util.nvl(obj["course__info__id1"])
						, "홀": _util.nvl(obj["hole"])
						, "가격": _util.nvl(obj["greenfee"])
						, "원가": _util.nvl(obj["price"])
						, "이벤트": szEvent
						, "상태코드": _util.nvl(obj["reserv__status"])
					});
				}
			}
			
			arg["콜백"].apply(null, [res]);
		});
	}
}

// 컨트롤
function clsBookingControl()
{
	this.objComm = null;
	this.objLeftReserveType = null;
	this.objCalendar = null;
	this.objAreaGolfList = null;
	this.objMyReserveListConfirm = null;
	
	this.bLoad = null;
	
	this._permitStart = null;
	
	this._init();
}

clsBookingControl.prototype = {
	_init: function(){
		this._preload();
		
		
		
		this.objComm = new clsBookingComm();
		this.objLeftReserveType = new clsLeftReserveType();
		this.objCalendar = new clsCalendar();
		this.objAreaGolfList = new clsAreaGolfList();
		this.objMyReserveListConfirm = new clsMyReserveListConfirm();
		
		this._beforeStart();
		this._bind();
	}
	, _preload: function(){
		$.ajax({
			url: _ROOT + "/booking/date_reserve.html"
			, type: "get"
			, dataType: "html"
			, async: false
			, success: function(ret){
				var s = ret.indexOf("<section id=\"left_content");
				var e = ret.indexOf("<!--//   id=\"left_content\" 끝-->");
				var html = ret.substring(s, e);
				
				$("div#container section#left_content").remove();
				$("div#container").prepend(html);
			}
			, error: function(){
				alert("error");
			}
		});
	}
	, _beforeStart: function(){
		var thisClass = this;
		
		this._permitStart = {
			"지역": false
			, "나의설정": false
			, "나의예약": false
		}
		
		_util.executeThread(function(){
			return _gf.getAreaCodeData();
		}, function(){
			thisClass.objAreaGolfList.spinStart();
			var areaClone1 = _util.objectCopy(_gf.getAreaCodeData());
			thisClass.objAreaGolfList.setAreaList(areaClone1);
			
			// 골프장리스트
			thisClass.objComm.getGolfList({
				"콜백": function(ret){
					if(ret["메시지"]) alert(ret["메시지"]);
					if(ret["결과코드"] != "00000") return;
					
					thisClass.objAreaGolfList.setGolfList(ret["결과값"]);
					
					var q_areagolf = _util.getParam("q_areagolf");
					
					if(q_areagolf){
						var aAreaGolf = q_areagolf.split(",");
						var tmp = [];
						for(i=0;i<aAreaGolf.length;i+=2){
							tmp.push({
								"지역코드": aAreaGolf[i]
								, "골프장코드": aAreaGolf[i+1]
							});
						}
						thisClass.objAreaGolfList.spinEnd();
						thisClass.objAreaGolfList.setMyConfig(tmp);
						
						thisClass._permitStart["나의설정"] = true;
					}else{
						// 나의 설정 요청
						thisClass.objComm.getMyConfig({
							"콜백": function(ret){
								if(ret["메시지"]) alert(ret["메시지"]);
								if(ret["결과코드"] != "00000") return;
								
								thisClass.objAreaGolfList.spinEnd();
								
								thisClass.objAreaGolfList.setMyConfig(ret["결과값"]);
								
								thisClass._permitStart["나의설정"] = true;
							}
						});
					}
				}
			});
			
			thisClass._permitStart["지역"] = true;
		});
		
		// 나의 예약내역
		if(_util.getCookie("member_id")){
			this.objComm.getRecentReserveList({
				"콜백": function(ret){
					thisClass.finishRecentReserveList(ret)
				}
			});
		}else{
			this._permitStart["나의예약"] = true;
		}
		
		_util.executeThread(function(){
			for(var key in thisClass._permitStart){
				if(!thisClass._permitStart[key]) return false;
			}
			
			return true;
		}, function(){
			thisClass.bLoad = true;
		});
		
		
	}
	, _bind: function(){
		var thisClass = this;
		
		// 예약분류 선택
		this.objLeftReserveType.$getLayer().on("change", "select", function(){
			var n = thisClass.objLeftReserveType.getIdx();
			
			switch(n){
				case 0:
					thisClass.goReserveTimePage();
					break;
//				case 1:
//					thisClass.goWaitingTimePage();
//					break;
				case 1:
					thisClass.goEventListPage();
					break;
			}
		});
		
		// 달력의 날짜 클릭
		this.objCalendar.$getLayer().on("click", "tbody tr td, span.bt_prev, span.bt_next", function(){
			var tName = this.tagName.toUpperCase();
			
			switch(tName){
				case "TD":
					var td = new Date();
					var d = $(this).data("날짜");
					
					if(td.getTime() > d) return;
				
					thisClass.setCalendarDate($(this).data("날짜"));
					break;
				case "SPAN":
					var cName = $(this).attr("class").toUpperCase();
					
					if(cName.indexOf("BT_PREV") != -1){
						thisClass.objCalendar.prevMonth();
					}else if(cName.indexOf("BT_NEXT") != -1){
						thisClass.objCalendar.nextMonth();
					}		
					break;
			}
			
		});
		
		$("div#container section#left_content").on("click", "img[alt='전체 현황검색'], img[alt='my설정']", function(){
			var alt = $(this).attr("alt");
			
			switch(alt){
				case "전체 현황검색": 
					thisClass.goMainPage();
					break;
				case "my설정": 
					var winMyArea = window.open(_ROOT + "/popup/pop_fix.html", "winMyArea", "width=600, height=100, scrollbars=0");
					if(winMyArea) winMyArea.focus();
					break;
			}
		});
		
		// 좌측 지역선택 체크박스
		this.objAreaGolfList.$getLayer().on("click", "input:checkbox", function(){
				var $p = $(this).parent().parent();
				
				switch($p.get(0).tagName.toUpperCase()){
					case "DD":
						thisClass.objAreaGolfList.checkcheck();
						break;
					case "DT":
						var n = thisClass.objAreaGolfList.$getLayer().find("input:checkbox").index($(this));
						var v = $(this).prop("checked");
						
						if(n === 0){
							thisClass.objAreaGolfList.$getLayer().find("input:checkbox:gt(0)").prop("checked", v);
						}else{
							var $n = $p.next("dd");
							$n.find("input:checkbox").prop("checked", v);
						}
						break;
				}
		});
		
		// 나의 예약내역 확인
		this.objMyReserveListConfirm.$getLayer().on("click", null, function(){
			var winMyReserveList = window.open(_ROOT + "/popup/pop_myreserve.html", "winMyReserveList", "width=900, height=320, scrollbars=0");
			if(winMyReserveList) winMyReserveList.focus();
		});
	}
	, _start: function(ssuper, bHide){
		var thisClass = this;
		
		ssuper.getCalendarPeriod = function(){
			return thisClass.getCalendarPeriod();
		}
		
		ssuper.$getAreaGolfListLayer = function(){
			return thisClass.$getAreaGolfListLayer();
		}
		
		ssuper.closeMySetting = function(w){
			thisClass.closeMySetting(w);
		}
		
		if(bHide){
			var $cl = this.objCalendar.$getLayer();
			var $ag = this.objAreaGolfList.$getLayer();
			
			$cl.hide().prev("h6").hide();
			$ag.parent().hide().prev("h6").hide();
		}else{
			var q_sdate = _util.getParam("q_sdate");
		
			// 기본날짜 설정
			var tomorow = new Date();
			var cDate = new Date();
			
			if(q_sdate){
				tomorow.setTime(q_sdate);
			}else{
				tomorow.setHours(0);
				tomorow.setMinutes(0);
				tomorow.setSeconds(0);
				tomorow.setMilliseconds(0);
				tomorow.setDate(tomorow.getDate()+1);
			}
			
			cDate.setTime(tomorow.getTime());
			
			this.objCalendar.setInfo("달력일", cDate);
			this.objCalendar.setInfo("시작일", tomorow);
		}
	}
	, isLoad: function(){
		return this.bLoad;
	}
	// 예약분류 세팅
	, setReserveType: function(n){
		this.objLeftReserveType.setIdx(n);
	}
	// 달력선택
	, setCalendarDate: function(objDate){
		if(objDate) this.objCalendar.setInfo("시작일", objDate);
		
		$(this).trigger("calendarChange");
	}
	, getCalendarPeriod: function(){
		return 14;
	}
	// 달력 선택 날짜
	, getCalendarDate: function(){
		return this.objCalendar.getSDate();
	}
	// 지역선택 골프장 코드 조합
	, getAreaGolfValues: function(){
		return this.objAreaGolfList.getValue();
	}
	// 관심지역 레이어 dl
	, $getAreaGolfListLayer: function(){
		return this.objAreaGolfList.$getLayer().clone(true);
	}
	// my설정 완료
	, closeMySetting: function(w){
		var thisClass = this;
		if(w) w.close();
		
		thisClass.objAreaGolfList.setMyConfig([]);
		this.goMainPage();
		
//		this.objAreaGolfList.spinStart();
//		// 나의 설정 요청
//		this.objComm.getMyConfig({
//			"콜백": function(ret){
//				if(ret["메시지"]) alert(ret["메시지"]);
//				if(ret["결과코드"] != "00000") return;
//				
//				thisClass.objAreaGolfList.spinEnd();
//				
//				thisClass.objAreaGolfList.setMyConfig(ret["결과값"]);
//				
//				thisClass.goMainPage();
//			}
//		});
		
		//document.location.reload();
	}
	// 나의예약 완료
	, finishRecentReserveList: function(ret){
		this.objMyReserveListConfirm.setList(ret["결과값"]);
		this._permitStart["나의예약"] = true;
	}
	// 메인 이동
	, goMainPage: function(){
		var n = this.objLeftReserveType.getIdx();
			
		switch(n){
			case 0:
				this.goReserveTimePage();
				break;
//			case 1:
//				this.goWaitingTimePage();
//				break;
			case 1:
				this.goEventListPage();
				break;
		}
	}
	// 리스트 페이지 이동
	, goListPage: function(){
		var n = this.objLeftReserveType.getIdx();
			
		switch(n){
			case 0:
				this.goReserveListPage();
				break;
//			case 1:
//				this.goWaitingListPage();
//				break;
			case 1:
				this.goEventListPage();
				break;
		}
	}
	// 실시간 예약 이동
	, goReserveTimePage: function(){
		var sDate = this.objCalendar.getSDate();
		
		var op = {
			"q_areagolf": this.objAreaGolfList.getValue()
			, "q_sdate": sDate ? sDate.getTime():""
		}
		
		var szLink = _ROOT + "/booking/date_reserve.html" + _util.object2paramString(op);
		document.location.href = szLink;
	}
	// 웨이팅 예약 이동
	, goWaitingTimePage: function(){
		var sDate = this.objCalendar.getSDate();
		
		var op = {
			"q_areagolf": this.objAreaGolfList.getValue()
			, "q_sdate": sDate ? sDate.getTime():""
		}
		
		var szLink = _ROOT + "/booking/waiting.html" + _util.object2paramString(op);
		document.location.href = szLink;
	}
	// 이벤트 리스트 이동
	, goEventListPage: function(){
		var szLink = _ROOT + "/booking/event_list.html";
		document.location.href = szLink;
	}
	// 실시간 예약 리스트 이동
	, goReserveListPage: function(selDate, courseInfo){
		var op = {
			"q_areagolf": _util.getParam("q_areagolf")
			, "q_sdate": this.objCalendar.getSDate().getTime()
			, "q_date": selDate.getTime()
		}
		if(courseInfo){
			op["q_area"] = courseInfo["지역코드"];
			op["q_golf"] = courseInfo["골프장코드"];
			op["q_course"] = courseInfo["코스코드"];
		}
		
		var szLink = _ROOT + "/booking/reserve_list.html" + _util.object2paramString(op);
		document.location.href = szLink;
	}
	// 웨이팅 예약 리스트 이동
	, goWaitingListPage: function(selDate, courseInfo){
		var op = {
			"q_areagolf": _util.getParam("q_areagolf")
			, "q_sdate": this.objCalendar.getSDate().getTime()
			, "q_date": selDate.getTime()
		}
		if(courseInfo){
			op["q_area"] = courseInfo["지역코드"];
			op["q_golf"] = courseInfo["골프장코드"];
			op["q_course"] = courseInfo["코스코드"];
		}
		
		var szLink = _ROOT + "/booking/waiting_list.html" + _util.object2paramString(op);
		document.location.href = szLink;
	}
}